home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / xfs / xqm.h < prev   
Encoding:
C/C++ Source or Header  |  2008-10-04  |  6.1 KB  |  152 lines

  1. /*
  2.  * Copyright (c) 1995, 2001, 2004-2005 Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This program is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU Lesser General Public License
  7.  * as published by the Free Software Foundation.
  8.  *
  9.  * This program is distributed in the hope that it would be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU Lesser General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Lesser General Public License
  15.  * along with this program; if not, write the Free Software Foundation,
  16.  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  17.  */
  18. #ifndef __XQM_H__
  19. #define __XQM_H__
  20.  
  21. #include <xfs/xfs.h>
  22.  
  23. /*
  24.  * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM).
  25.  */
  26.  
  27. #define XQM_CMD(x)    (('X'<<8)+(x))    /* note: forms first QCMD argument */
  28. #define Q_XQUOTAON    XQM_CMD(1)    /* enable accounting/enforcement */
  29. #define Q_XQUOTAOFF    XQM_CMD(2)    /* disable accounting/enforcement */
  30. #define Q_XGETQUOTA    XQM_CMD(3)    /* get disk limits and usage */
  31. #define Q_XSETQLIM    XQM_CMD(4)    /* set disk limits */
  32. #define Q_XGETQSTAT    XQM_CMD(5)    /* get quota subsystem status */
  33. #define Q_XQUOTARM    XQM_CMD(6)    /* free disk space used by dquots */
  34. #define Q_XQUOTASYNC    XQM_CMD(7)    /* delalloc flush, updates dquots */
  35.  
  36. /*
  37.  * fs_disk_quota structure:
  38.  *
  39.  * This contains the current quota information regarding a user/proj/group.
  40.  * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of
  41.  * 512 bytes.
  42.  */
  43. #define FS_DQUOT_VERSION    1    /* fs_disk_quota.d_version */
  44. typedef struct fs_disk_quota {
  45.     __s8        d_version;    /* version of this structure */
  46.     __s8        d_flags;    /* XFS_{USER,PROJ,GROUP}_QUOTA */
  47.     __u16        d_fieldmask;    /* field specifier */
  48.     __u32        d_id;        /* user, project, or group ID */
  49.     __u64        d_blk_hardlimit;/* absolute limit on disk blks */
  50.     __u64        d_blk_softlimit;/* preferred limit on disk blks */
  51.     __u64        d_ino_hardlimit;/* maximum # allocated inodes */
  52.     __u64        d_ino_softlimit;/* preferred inode limit */
  53.     __u64        d_bcount;    /* # disk blocks owned by the user */
  54.     __u64        d_icount;    /* # inodes owned by the user */
  55.     __s32        d_itimer;    /* zero if within inode limits */
  56.                     /* if not, we refuse service */
  57.     __s32        d_btimer;    /* similar to above; for disk blocks */
  58.     __u16          d_iwarns;       /* # warnings issued wrt num inodes */
  59.     __u16          d_bwarns;       /* # warnings issued wrt disk blocks */
  60.     __s32        d_padding2;    /* padding2 - for future use */
  61.     __u64        d_rtb_hardlimit;/* absolute limit on realtime blks */
  62.     __u64        d_rtb_softlimit;/* preferred limit on RT disk blks */
  63.     __u64        d_rtbcount;    /* # realtime blocks owned */
  64.     __s32        d_rtbtimer;    /* similar to above; for RT disk blks */
  65.     __u16          d_rtbwarns;     /* # warnings issued wrt RT disk blks */
  66.     __s16        d_padding3;    /* padding3 - for future use */
  67.     char        d_padding4[8];    /* yet more padding */
  68. } fs_disk_quota_t;
  69.  
  70. /*
  71.  * These fields are sent to Q_XSETQLIM to specify fields that need to change.
  72.  */
  73. #define FS_DQ_ISOFT    (1<<0)
  74. #define FS_DQ_IHARD    (1<<1)
  75. #define FS_DQ_BSOFT    (1<<2)
  76. #define FS_DQ_BHARD     (1<<3)
  77. #define FS_DQ_RTBSOFT    (1<<4)
  78. #define FS_DQ_RTBHARD    (1<<5)
  79. #define FS_DQ_LIMIT_MASK    (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \
  80.                  FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD)
  81. /*
  82.  * These timers can only be set in super user's dquot. For others, timers are
  83.  * automatically started and stopped. Superusers timer values set the limits
  84.  * for the rest.  In case these values are zero, the DQ_{F,B}TIMELIMIT values
  85.  * defined below are used.
  86.  * These values also apply only to the d_fieldmask field for Q_XSETQLIM.
  87.  */
  88. #define FS_DQ_BTIMER    (1<<6)
  89. #define FS_DQ_ITIMER    (1<<7)
  90. #define FS_DQ_RTBTIMER     (1<<8)
  91. #define FS_DQ_TIMER_MASK    (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER)
  92.  
  93. /*
  94.  * Warning counts are set in both super user's dquot and others. For others,
  95.  * warnings are set/cleared by the administrators (or automatically by going
  96.  * below the soft limit).  Superusers warning values set the warning limits
  97.  * for the rest.  In case these values are zero, the DQ_{F,B}WARNLIMIT values
  98.  * defined below are used.
  99.  * These values also apply only to the d_fieldmask field for Q_XSETQLIM.
  100.  */
  101. #define FS_DQ_BWARNS    (1<<9)
  102. #define FS_DQ_IWARNS    (1<<10)
  103. #define FS_DQ_RTBWARNS    (1<<11)
  104. #define FS_DQ_WARNS_MASK    (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS)
  105.  
  106. /*
  107.  * Various flags related to quotactl(2).  Only relevant to XFS filesystems.
  108.  */
  109. #define XFS_QUOTA_UDQ_ACCT    (1<<0)  /* user quota accounting */
  110. #define XFS_QUOTA_UDQ_ENFD    (1<<1)  /* user quota limits enforcement */
  111. #define XFS_QUOTA_GDQ_ACCT    (1<<2)  /* group quota accounting */
  112. #define XFS_QUOTA_GDQ_ENFD    (1<<3)  /* group quota limits enforcement */
  113. #define XFS_QUOTA_PDQ_ACCT    (1<<4)  /* project quota accounting */
  114. #define XFS_QUOTA_PDQ_ENFD    (1<<5)  /* project quota limits enforcement */
  115.  
  116. #define XFS_USER_QUOTA        (1<<0)    /* user quota type */
  117. #define XFS_PROJ_QUOTA        (1<<1)    /* project quota type */
  118. #define XFS_GROUP_QUOTA        (1<<2)    /* group quota type */
  119.  
  120. /*
  121.  * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system.
  122.  * Provides a centralized way to get meta infomation about the quota subsystem.
  123.  * eg. space taken up for user and group quotas, number of dquots currently
  124.  * incore.
  125.  */
  126. #define FS_QSTAT_VERSION    1    /* fs_quota_stat.qs_version */
  127.  
  128. /*
  129.  * Some basic infomation about 'quota files'.
  130.  */
  131. typedef struct fs_qfilestat {
  132.     __u64        qfs_ino;    /* inode number */
  133.     __u64        qfs_nblks;    /* number of BBs 512-byte-blks */
  134.     __u32        qfs_nextents;    /* number of extents */
  135. } fs_qfilestat_t;
  136.  
  137. typedef struct fs_quota_stat {
  138.     __s8        qs_version;    /* version number for future changes */
  139.     __u16        qs_flags;    /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
  140.     __s8        qs_pad;        /* unused */
  141.     fs_qfilestat_t    qs_uquota;    /* user quota storage information */
  142.     fs_qfilestat_t    qs_gquota;    /* group quota storage information */
  143.     __u32        qs_incoredqs;    /* number of dquots incore */
  144.     __s32        qs_btimelimit;  /* limit for blks timer */
  145.     __s32        qs_itimelimit;  /* limit for inodes timer */
  146.     __s32        qs_rtbtimelimit;/* limit for rt blks timer */
  147.     __u16        qs_bwarnlimit;    /* limit for num warnings */
  148.     __u16        qs_iwarnlimit;    /* limit for num warnings */
  149. } fs_quota_stat_t;
  150.  
  151. #endif    /* __XQM_H__ */
  152.